﻿using System;
using System.Threading.Tasks;
using log4net;
using MaximServices.Common;
using MaximServices.Services;
using Quartz;
using Quartz.Logging;
using Autofac;
using MaximServices.Model;

namespace MaximJob
{
    public class MaximNotEnougCheckJob : IJob
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(MaximNotEnougCheckJob));

        private MottoCheckServices _mottoCheckServices;

        public MaximNotEnougCheckJob()
        {
        }

        public virtual Task Execute(IJobExecutionContext context)
        {
            //JobKey jobKey = context.JobDetail.Key;
            log.Info("自动检测词条是否足够的任务开始执行...");

            using (var scope = ServiceLocator.Instance.BeginLifetimeScope())
            {
                _mottoCheckServices = scope.Resolve<MottoCheckServices>();

                _mottoCheckServices.MaximNotEnougCheck();
            }

            log.Info("自动检测词条是否足够的任务完成...");

            return Task.CompletedTask;
        }
    }
}